package com.wwj.controller.user;


import com.wwj.common.result.PageResult;
import com.wwj.common.result.Result;
import com.wwj.pojo.dto.SetmealPageQueryDTO;
import com.wwj.pojo.entity.Setmeal;
import com.wwj.pojo.vo.SetmealVO;
import com.wwj.service.SetmealService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.springframework.cache.annotation.Cacheable;
import org.springframework.data.redis.core.RedisTemplate;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;
import java.util.List;
import java.util.Set;

@RestController("userSetmealController")
@RequestMapping("/user/setmeal")
@Slf4j
@Api(tags="套餐相关接口")
public class SetmealController {
    @Resource
    private SetmealService setmealService;



    @GetMapping("/page")
    @ApiOperation(value = "分页查询")
    @Cacheable(cacheNames = "setmealCache",
            key = "#setmealPageQueryDTO.categoryId + '_'+ #setmealPageQueryDTO.people" +
                    "+ '_'+#setmealPageQueryDTO.page+ '_'+#setmealPageQueryDTO.pageSize")
    public Result<PageResult> pageQuery(SetmealPageQueryDTO setmealPageQueryDTO){
        PageResult pageResult=setmealService.pageQueryUser(setmealPageQueryDTO);
        return Result.success(pageResult);
    }


}
